/**
 * Created by chenweicheng on 7/3/2017.
 */
'use strict';

/**
 * 本文件为ProtobufJsManager的配置文件
 * 修改时只需修改协议内容，headerType 内容,getParseMessage switch内容即可
 *
 */


var toothProtocol = "package myProto;\n" +
    "\n" +
    "syntax = \"proto3\";\n" +
    "\n" +
    "message SnapApp {\n" +
    "\tuint32 loopCount = 1;\n" +
    "    string timestamp = 2;\n" +
    "    uint32 type = 3;              \n" +
    "\tSnapConfig config = 4;        \n" +
    "\tuint32 start = 5;\t             \n" +
    "\tuint32 queryDataList = 6;     \n" +
    "    uint32 queryData = 7;         \n" +
    "\tuint32 queryDataEnv = 8;      \n" +
    "\tuint32 queryAudioList = 9;     \n" +
    "\tuint32 queryAudioWav =10;       \n" +
    "\n" +
    "}\n" +
    "\n" +
    "message SnapConfig{\n" +
    "\tstring SSID = 1;\n" +
    "\tstring password= 2;\n" +
    "}\n" +
    "\n" +
    "\n" +
    "\n" +
    "message SnapDevice{\n" +
    "\tuint32 loopCount = 1;\n" +
    "    uint32 type = 2; \n" +
    "\tSnapBroadcast broadcast = 3;\n" +
    "\tuint32 ret = 4;\n" +
    "\tSnapDataList dataList = 5;\n" +
    "\tSnapPointList pointList = 6;\n" +
    "\tSnapEnvList envList = 7;\n" +
    "    SnapAudioList audioList =8;\n" +
    "    SnapAudioWavList audioWavList = 9;\n" +
    "\n" +
    "}\n" +
    "\n" +
    "message SnapBroadcast {\n" +
    "\tstring IP = 1;\n" +
    "\tstring sn = 2;\n" +
    "} \n" +
    "\n" +
    "\n" +
    "message SnapDataList {\n" +
    "\tuint32 length = 1;\n" +
    "\trepeated SnapData data = 2;\n" +
    "}\n" +
    "\n" +
    "message SnapData {\n" +
    "\tuint32 index = 1;\n" +
    "\tstring name = 2;\n" +
    "\tstring startTime = 3;\n" +
    "\tuint32 timeLength = 4;\n" +
    "\tuint32 rate = 5;\t\n" +
    "\tuint32 dataGroups = 6;\n" +
    "\tuint32 s1Length = 7; \n" +
    "\tuint32 s2Length = 8; \n" +
    "\tuint32 s3Length = 9;\n" +
    "\n" +
    "}\n" +
    "\n" +
    "\n" +
    "message SnapPointList {\n" +
    "    repeated SnapPoint  pointS1 = 1;\n" +
    "\trepeated SnapPoint  pointS2 = 2;\n" +
    "    repeated SnapPoint  pointS3 = 3;\n" +
    "}\n" +
    "\n" +
    "message SnapPoint {\n" +
    "\tuint32 index = 1;\n" +
    "\tfloat x1 = 2;\n" +
    "\tfloat x2 = 3;\n" +
    "}\n" +
    "\n" +
    "\n" +
    "message SnapEnvList {\n" +
    "\tuint32 length = 1; \n" +
    "    repeated SnapEnv env = 2;\n" +
    "}\n" +
    "\n" +
    "message SnapEnv {\n" +
    "    uint32 index = 1;\n" +
    "\tfloat  air = 2;\n" +
    "\tuint32 temp = 3;\n" +
    "\tuint32 wet = 4;\n" +
    "\tuint32 db = 5; \t\n" +
    "}\n" +
    "\n" +
    "message SnapAudioList {\n" +
    "\tuint32 length = 1;\n" +
    "\trepeated SnapAudio audio = 2;\n" +
    "}\n" +
    "\n" +
    "message SnapAudio {\n" +
    "\tuint32 index = 1;  \n" +
    "\tstring name = 2;\n" +
    "\t\n" +
    "}\n" +
    "\n" +
    "message  SnapAudioWavList{\n" +
    "    uint32 length = 1; \n" +
    "\trepeated SnapAudioWav audioWav = 2;\n" +
    "}\n" +
    "\n" +
    "message  SnapAudioWav{\n" +
    "\tuint32 index = 1; \n" +
    "\tstring audioWav =2 ;\n" +
    "}"

class ProtobufJsSupport {

    getProto() {
        return toothProtocol
    }

    getParseMessageName(messageId) {
        switch (messageId) {
            case this.headerType.SnapApp:
                console.log("myProto.SnapApp")
                return "myProto.SnapApp";
            case this.headerType.SnapDevice:
                return "myProto.SnapDevice";

        }
    }


    headerType = {
        SnapApp: 0,
        SnapDevice: 1,
    };

}


module.exports = new ProtobufJsSupport();